<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">

    </div>
    <template id="tel">
        <div>
            <h1>{{message}}</h1>
            <h2>{{count}}</h2>
            <button @click="add">+1</button>
            <button @click="decrement">-1</button>
        </div>
    </template>

    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script>
        Vue.createApp({
            template: "#tel",
            data() {

                const message = 'hello world'
                return {
                    message,
                    count: 1,
                }
            },
            methods: {
                add() {
                    this.count++// 相当于 this.data.count,this 为Vue实例
                },
                decrement() {
                    this.count--
                }
            },
        }).mount("#app")
    </script>
</body>

</html>